package com.hrh.hrhaiagent.agent;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import com.hrh.hrhaiagent.agent.model.AgentState;

@Data
@Slf4j
public abstract class ReActAgent extends BaseAgent{
    public abstract boolean think();

    public abstract String act();

    @Override
    public String step(){
        try {
            boolean shouldAct = think();
            if (!shouldAct){
                return "思考完成";
            }
            return act();
        } catch (Exception e) {
            log.error("[{}] step()发生异常: {}", getName(), e.getMessage(), e);
            return "发生错误：" + e.getMessage();
        }
    }
}
